home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 339 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.1 KB

  1. Path: cs.mu.OZ.AU!bounce-back
  2. From: jbuck@Synopsys.COM (Joe Buck)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Inherent C++ problem??
  5. Date: 09 Feb 96 02:49:34 GMT
  6. Organization: Synopsys Inc., Mountain View, CA 94043-4033
  7. Approved: fjh@cs.mu.oz.au
  8. Message-ID: <4fdms4$ki9@hermes.synopsys.com>
  9. References: <199602060648.HAA19423@mail.pi.se>
  10. NNTP-Posting-Host: munta.cs.mu.oz.au
  11. X-Original-Date: 8 Feb 1996 20:36:20 GMT
  12. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  13.     iQBFAgUBMRq2S+EDnX0m9pzZAQEsygF/Q95Dx9WzJOaVYo4hy757qAyehwLAG+rR
  14.     VVe0AlKfTtlYUEz2rmxyZ8Kk+g3vD7oy
  15.     =7ND4
  16. Originator: fjh@munta.cs.mu.OZ.AU
  17.  
  18. william.mc@pi.se (William McIlhagga) writes:
  19. >1) The standard says that an implementation *may* get rid of some copy
  20. >constructors; it does not demand it. Thus the indeterminism lies in the fact
  21. >that the programmer does not know whether this has happened to their code,
  22. >unless the compiler is kind enough to say so (compilers are the strong
  23. >silent type, and don't usually tell you anything about what they're thinking)
  24.  
  25. This indeterminism is completely invisible for copy constructors that
  26. perform a copy operation and do nothing else.  It only shows up if the
  27. code writer includes side effects (printing of messages, etc).
  28.  
  29. >2) Removing copy constructors is intended as an optimisation. But
  30. >optimisations should never change the meaning of a program - that is, the
  31. >program should produce the same results with and without the optimisation.
  32.  
  33. Which is why programmers must write copy constructors in such a way as to
  34. make this true (the program should produce the same results).  If the
  35. removal of a copy constructor changes the meaning of your program, you've
  36. written a broken copy constructor.  It simply is not a problem in
  37. practice.
  38.  
  39.  
  40.  
  41.  
  42. -- 
  43. -- Joe Buck     <jbuck@synopsys.com>    (not speaking for Synopsys, Inc)
  44.  
  45. Work for something because it is good,
  46. not just because it stands a chance to succeed.       -- Vaclav Havel
  47. ---
  48. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  49.   Contact address: std-c++-request@ncar.ucar.edu.  Moderation policy:
  50.   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html. ]
  51.